package nsfs

import "fmt"

type OpenDirectoryMode uint

func (m OpenDirectoryMode) String() string {
	switch m {
	case OpenDirectoryModeDirectory:
		return "Directory"
	case OpenDirectoryModeFile:
		return "File"
	case OpenDirectoryModeNoFileSize:
		return "NoFileSize"
	case OpenDirectoryModeAll:
		return "All"
	default:
		return fmt.Sprintf("OpenDirectoryMode(%d)", m)
	}
}

const (
	OpenDirectoryModeDirectory  = OpenDirectoryMode(1)
	OpenDirectoryModeFile       = OpenDirectoryMode(1 << 1)
	OpenDirectoryModeNoFileSize = OpenDirectoryMode(1 << 31)
	OpenDirectoryModeAll        = OpenDirectoryMode(OpenDirectoryModeDirectory | OpenDirectoryModeFile)
)

func (m OpenDirectoryMode) HasFlag(mode OpenDirectoryMode) bool {
	return (mode & m) > 0
}

type IDirectory interface {
	Read(data []*DirectoryEntry) (int, error)
}
